package com.news.yp.baselibrary.navigationbottom;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

public abstract class BottomTabItem {
    private View mTabItemView;
    private int mLayoutId;
    private Context mContext;

    public BottomTabItem(int mLayoutId, Context mContext) {
        this.mLayoutId = mLayoutId;
        this.mContext = mContext;
    }

    /**
     * 获取底部条目的显示
     */
    public View getTabView() {
        if (mTabItemView == null) {
            mTabItemView = LayoutInflater.from(mContext).inflate(mLayoutId, null);
            initLayout();
        }
        return mTabItemView;
    }

    /**
     * 初始化显示
     */
    protected abstract void initLayout();

    protected <T> T findViewById(int id) {
        return (T) mTabItemView.findViewById(id);
    }

    /**
     * 是否选择了当前条目
     */
    protected abstract void setSelected(boolean selected);
}
